Skip to content

fix(kernel): harden read-back, commit gating, settle, filters, probe/ACI, qualify, and receipts - #2713

Merged
abrichr merged 1 commit into
mainfrom
fix/kernel-hardening-7
Nov 26, 2026
Merged

abrichr merged 1 commit into
mainfrom
fix/kernel-hardening-7

Conversation

@abrichr

@abrichr abrichr commented Nov 26, 2026

Copy link
Copy Markdown
Member

Summary

Fixes 7 runtime verification defects in packages/kernel while staying under the 3,200 LOC budget (3,187 LOC total) with zero openadapt_flow imports:

  1. Field-bound, target-origin read-back (oracles.py): Scope verify_cross_tab_dom to the mutated target tab/origin so a source/reference tab cannot satisfy a write. Extract labeled DOM controls/definitions/tables and require field/label bindings for 1–2 char values (e.g., "1", "CA") instead of bare free-text substring matches.
  2. Commit detection gates VERIFIED (runner.py, interceptor.py): Gate VERIFIED on either an observed target-origin mutating HTTP 2xx response (POST/PUT/PATCH/DELETE) or a pre-click-absent -> post-reload-present target-field transition. A no-op click over stale DOM text no longer returns VERIFIED.
  3. Event-driven settle (interceptor.py, runner.py): Replace the hardcoded 300 ms sleep before reload with CommitInterceptor.wait_for_commit_settle, waiting for in-flight target-origin mutating requests and a short MutationObserver DOM quiet window (default 5000 ms timeout).
  4. Strict search-box and telemetry filters (interceptor.py): Restrict search-box filtering to explicit attributes (type="search", role="searchbox") and word-boundary search/filter terms so fields like "Clinical findings" and "Sort code" remain tracked. Restrict telemetry ignorelists to explicit analytics hosts and exact path segments so POST /api/collections/... is not dropped.
  5. Wire hover/focus probe and ACI calibrator into run_portal_pack (probe.py, runner.py): Gate pre-click safety on focus_responded in probe_before_click and update OnlineACICalibrator from Level-2/3 read-back ground truth Y_t inside run_portal_pack.
  6. Require real pre-write DOM snapshot in qualify (copilot.py, cli.py, mcp_server.py, extension_bridge.py): Remove the constant default "Draft form before submission" string and raise ValueError when no captured pre-write snapshot is provided via argument or pre_write evidence event.
  7. Zero-PHI receipts, sign all terminal outcomes, UUIDv4 episode IDs (copilot.py, ledger.py, runner.py, registry.py, cli.py, mcp_server.py): Default mint_receipt to zero-PHI redacted mode (SHA-256 hashes of typed values + origin host only, with include_plaintext_values=False debug opt-in), sign every terminal outcome (VERIFIED, HALTED, FAILED, PREPARE_REQUIRED, ESCALATED), and default episode IDs to unique UUIDv4s instead of "ep-live-1".
  8. Docs: Update < 2,800 LOC claim in packages/kernel/README.md to < 3,200 LOC to match the CI boundary guard.

Verification

  • packages/kernel source LOC: 3,187 (< 3,200 budget)
  • python3 scripts/check_legacy_flow_freeze.py: passed
  • ruff check src tests: passed
  • pytest -q (packages/kernel): 29 passed (including 7 new regression tests in tests/test_kernel_hardening.py)

@abrichr
abrichr enabled auto-merge November 26, 2026 01:24
@abrichr
abrichr added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit bf99ada Nov 26, 2026
43 checks passed
@abrichr
abrichr deleted the fix/kernel-hardening-7 branch November 26, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant